package com.bsj.pay.task;

import com.bsj.pay.config.GlobalConfig;
import com.bsj.pay.service.IpPoolService;
import com.bsj.pay.service.PayGoodsService;
import com.bsj.pay.service.PayPoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class UpdatePayPoolTask {
	@Autowired
	private PayGoodsService payGoodsService;
	
	private static boolean isReturn=true;

	@Scheduled(fixedRate = 15000)
	public void execute() {
		try {
			if (UpdatePayPoolTask.isReturn&&GlobalConfig.isInit)
			{
				UpdatePayPoolTask.isReturn = false;
				this.payGoodsService.UpdatePayPoolTask();
				UpdatePayPoolTask.isReturn = true;
			}
		} catch (Exception e) {
			UpdatePayPoolTask.isReturn = true;
		}
	}
}